#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
int main() {

    int n, max = 0, min = 10000, num;

    scanf("%d", &n);

    for (int i = 0; i < n; i++)

    {

        scanf("%d", &num);

        if (num < min)

            min = num;

        if (num > max)

            max = num;

    }

    printf("%d", max - min);

    return 0;

}